package com.wh.music.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wh.music.POJO.Singer;
import com.wh.music.dao.SingerMapper;
import com.wh.music.service.SingerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SingerServiceImpl implements SingerService {

  @Autowired
  private SingerMapper singerMapper;

  @Override
  public int insertsinger(Singer singer) {
    return singerMapper.insertsinger(singer);
  }

  @Override
  public int updatesinger(Singer singer) {
    return singerMapper.updatesinger(singer);
  }

  @Override
  public int deletesinger(Long id) {
    return singerMapper.deletesinger(id);
  }

  @Override
  public int deletesingers(List<Long> ids) {
    return singerMapper.deletesingers(ids);
  }

  @Override
  public Singer queryByPrimaryKey(Long id) {
    return singerMapper.selectByPrimaryKey(id);
  }

  @Override
  public List<Singer> queryAllSinger() {
    return singerMapper.allSinger();
  }

  @Override
  public Page<Singer> findByPage(int pageNo, int pageSize, String name) {
    PageHelper.startPage(pageNo, pageSize);
    return singerMapper.findByPage(name);
  }

  @Override
  public Integer countSingers(String name) {
    return singerMapper.countSingers(name);
  }

  @Override
  public List<Singer> queryByName(String name) {
    return singerMapper.singerOfName(name);
  }

  @Override
  public List<Singer> queryBySex(Integer sex) {
    return singerMapper.singerOfSex(sex);
  }


}
